<template>
  <el-dialog
    class="dia-style"
    title="认证审核"
    :visible.sync="open"
    :modal-append-to-body="false"
    :close-on-click-modal="false"

  >
  <HkForm
      ref="hkFormRef"
      label-width="140"
      :form-labels="formObj.formLabels"
      :data="formData"
      :dict-list="formObj.dictList"
      :btn-hidden="true" >
    </HkForm>
    <div slot="footer" class="dialog-footer" v-if="type=='detail'">
      <el-button type="primary" @click="submitForm(2)">认证通过</el-button>
      <el-button type="primary" @click="submitForm(1)">拒绝</el-button>

      <el-button @click="cancel">返 回</el-button>
    </div>
  </el-dialog>
</template>
<script>
import HkForm from '@/components/HKForm'
import {getDetail,updateData} from '@/api/accessProduct/accessSystem.js'
export default {
  components:{HkForm},
  props: {
    typeLists:{
      type:Object,
      default(){
        return {}
      }
    }
  },
  data() {
    return {
      type:'',
      // 是否显示弹出层
      open: false,
      formObj:{
        formLabels:[
        { label: '单位名称', field: 'orgName', type: 'input',disabled:true, span: 24 },
        { label: '单位类别', field: 'orgType', type: 'select',list:'orgTypeList',disabled:true, span: 24 },
        { label: '保密资质', field: 'secretQualification', type: 'input',disabled:true,  span: 24 },
        { label: '涉密证书', field: 'netLicenseNumber', type: 'input',disabled:true,  span: 24 },
        { label: '综合审计证书', field: 'zjgLicenseNumber', type: 'input',disabled:true,  span: 24 },
        { label: '监测器证书', field: 'jcqLicenseNumber', type: 'input',disabled:true,  span: 24 },
        { label: '协议类型', field: 'type', type: 'input',disabled:true,  span: 24 },
        { label: 'I P', field: 'ip', type: 'input',disabled:true,  span: 24 },
        { label: '端口', field: 'port', type: 'input',disabled:true,  span: 24 },
        { label: '会话标识', field: 'clientId', type: 'input',disabled:true,  span: 24 },
        { label: '注册类型', field: 'online', type: 'select',list:'onlineList',disabled:true,  span: 24 },
        ],
        dictList:this.typeLists
      },
      
      formData:{},
    };
  },
  computed: {
  },
  watch: {},
  created() {},
  methods: {
    show(id,type) {
      this.type=type
      this.open = true;
      this.reset();
      getDetail(id).then(res=>{
        this.formData=res
      })
    },
    /** 认证通过按钮 */
    async submitForm(status) {
      let _this=this
      this.$modal
        .confirm('是否认证通过？')
        .then(function() {
          return updateData({id:_this.formData.id,status:status})
        })
        .then(() => {
          this.$modal.msgSuccess('认证通过!')
          this.open = false;
          this.$emit('submit')
        })
        .catch((error) => {
          console.log(error)
        })
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.formData = {
        id: undefined,
        code: undefined,
        createDate: undefined,
        flag: undefined,
        isDeleted: undefined,
        modifiedDate: undefined,
        name: undefined,
        sort: undefined,
      };
    },
  },
};
</script>

<style scoped lang="scss">

::v-deep .el-dialog__body {
  max-height:calc(100% - 116px);
  overflow: auto;
  padding:20px 60px !important;
}
::v-deep .el-dialog__wrapper .el-form-item {
    margin-bottom: 1px;
}

::v-deep .el-icon-date:before {
  // content: "";
  margin-left: 339px;
}
::v-deep .el-input--prefix .el-input__inner {
  padding-left: 15px;
}
::v-deep .el-textarea__inner {
  resize: none;
}
::v-deep {
  
  .el-dialog__body {
    height: auto !important;
  }
  .el-dialog__footer {
    position: absolute;
    bottom: 0;
  }
}
::v-deep .el-textarea__inner {
  width: 635px;
  height: 150px;
}
::v-deep [data-v-2d25da19] .el-input--prefix .el-input__inner {
  padding-left: 39px;
}
::v-deep [data-v-2d25da19] .el-icon-date:before {
  margin-left: 11px;
}
::v-deep [data-v-369a799c] .el-input--prefix .el-input__inner {
  padding-left: 30px;
}
</style>
